package Ms.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.sun.istack.internal.NotNull;
import Ms.entity.enums.UserStatus;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.time.LocalDateTime;

@Data
@TableName("user")
@Accessors(chain = true)
public class User {
    @TableId(type = IdType.AUTO)
    private Long adminId;

    @NotBlank(message = "账号不能为空")
    @Size(min = 5, max = 20, message = "账号长度5-20位")
    private String username;

    @JsonIgnore // 响应时忽略密码字段
    private String password;

    @NotNull
    private UserStatus status; // 枚举： ACTIVE/DISABLED/LOCKED

    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;

    // 角色类型：super-超级管理员 admin-普通管理员
    private String roleType;

    @TableLogic // 逻辑删除标记
    private Integer deleted;
}
